package com.gltc.framework;

import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;

import com.gltc.constant.Constant;
import com.gltc.entities.PhotoAuthUser;

public class SessionUtil {

private static ApplicationContext applicationContext;
	
	public static void applicationContext(ApplicationContext applicationContext) {
		SessionUtil.applicationContext = applicationContext;
	}
	
	public static PhotoAuthUser getUserSessEntity(){
		return (PhotoAuthUser)applicationContext.getBean(Constant.SESSION_USER_KEY);
	}
	
	public static void clearUserSessEntity(){
		PhotoAuthUser userSessEntity =  (PhotoAuthUser)applicationContext.getBean(Constant.SESSION_USER_KEY);
		
		BeanUtils.copyProperties(new PhotoAuthUser(), userSessEntity);
	}
}
